package be.kuleuven.thesis.framework;

import be.kuleuven.thesis.status.PlaylistGenerator;


public class Song {
	private String id;
	private String title;
	private String artist;
	private Album album;
	private int year;
	private int duration;
	private String location;
	private String origin;
	private float bpm;
	private String version;
	private String mood;
	private String dancingStyle;
	private int startAudioSignal;
	private int endAudioSignal;
	private String musicStyle;
	private int image;
	
	public Song() {
		
	}
	
	public Song(String title, String artist, int year, int image) {
		this.title = title;
		this.artist = artist;
		this.year = year;
		this.image = image;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getArtist() {
		return artist;
	}

	public void setArtist(String artist) {
		this.artist = artist;
	}

	public Album getAlbum() {
		return album;
	}

	public void setAlbum(Album album) {
		this.album = album;
	}

	public int getYear() {
		return year;
	}

	public void setYear(int year) {
		this.year = year;
	}

	public int getDuration() {
		return duration;
	}

	public void setDuration(int duration) {
		this.duration = duration;
	}

	public String getLocation() {
		return location;
	}

	public void setLocation(String location) {
		this.location = location;
	}

	public String getOrigin() {
		return origin;
	}

	public void setOrigin(String origin) {
		this.origin = origin;
	}

	public float getBpm() {
		return bpm;
	}

	public void setBpm(float bpm) {
		this.bpm = bpm;
	}

	public boolean isLocalAvailable() {
		return location != null;
	}

	public String getVersion() {
		return version;
	}

	public void setVersion(String version) {
		this.version = version;
	}

	public String getMood() {
		return mood;
	}

	public void setMood(String mood) {
		this.mood = mood;
	}

	public String getDancingStyle() {
		return dancingStyle;
	}

	public void setDancingStyle(String dancingStyle) {
		this.dancingStyle = dancingStyle;
	}

	public int getStartAudioSignal() {
		return startAudioSignal;
	}

	public void setStartAudioSignal(int startAudioSignal) {
		this.startAudioSignal = startAudioSignal;
	}

	public int getEndAudioSignal() {
		return endAudioSignal;
	}

	public void setEndAudioSignal(int endAudioSignal) {
		this.endAudioSignal = endAudioSignal;
	}

	public String getMusicStyle() {
		return musicStyle;
	}

	public void setMusicStyle(String musicStyle) {
		this.musicStyle = musicStyle;
	}

	public int getImage() {
		return image;
	}

	public void setImage(int image) {
		this.image = image;
	}
	
	public boolean satisfiesFilter(Filter filter) {
		return year >= filter.getMinYear() && year <= filter.getMaxYear() &&
				bpm >= filter.getMinTempo() && bpm <= filter.getMaxTempo() &&
				filter.getAtmospheres().contains(Atmosphere.getMood(mood));
	}
	
	public boolean equals(Song song) {
		return this.title.equals(song.getTitle()) && this.artist.equals(song.getArtist());
	}
	
	@Override
	public String toString() {
		String string = getArtist() + " - "+getTitle()+";(Origin="+getOrigin();
		if(PlaylistGenerator.getInstance().isRadioOn())
			string = string + ";Liked=" + PlaylistGenerator.getInstance().isLiked(this);
		return string + ")";
	}
}